package reader;

import newsEditor.ReadEvent;
import newsEventSystem.News;
import event.Event;
import event.Filter;

public class ReadingFilter implements Filter {

	private String domainName;
	private String source;

	public ReadingFilter(String domainName, String source) {
		this.domainName = domainName;
		this.source = source;
	}

	@Override
	public boolean apply(Event event) {
		if (!(event instanceof ReadEvent)) {
			return false;
		}
		News news = ((ReadEvent) event).getNews();
		if (news.getDomainName().equals(domainName)
				&& news.getInformationSource().equals(source)) {
			return true;
		}
		return false;
	}

}
